<template>
  <div class="container">
    <topTitle
      :titleText="titleText"
      :back="back"
      @gobackTriser="goBack"
    ></topTitle>
    <div class="mainCon">
      <table cellspacing="0" cellpadding="0" class="detailTable">
        <tbody>
          <tr>
            <td class="title">项目名称</td>
            <td class="content">{{ enterpriseInfo.projectName || '--' }}</td>
            <td class="title">责任主体社会信用代码</td>
            <td class="content">{{ enterpriseInfo.uscc || '--' }}</td>
          </tr>
          <tr>
            <td class="title">监管区域</td>
            <td class="content">{{ enterpriseInfo.areaName || '--' }}</td>
            <td class="title">责任主体企业名称</td>
            <td class="content">{{ enterpriseInfo.companyName || '--' }}</td>
          </tr>
          <tr>
            <td class="title">行业</td>
            <td class="content">{{ enterpriseInfo.industryName }}</td>
            <td class="title">奖惩情况</td>
            <td
              class="content general"
              v-if="enterpriseInfo.status == 'REWARD'"
            >
              {{ enterpriseInfo.statusDesc || '--' }}
            </td>
            <td
              class="content serious"
              v-else-if="enterpriseInfo.status == 'PUNISH'"
            >
              {{ enterpriseInfo.statusDesc || '--' }}
            </td>
          </tr>
          <tr>
            <td class="title">企业负责人姓名</td>
            <td class="content">{{ enterpriseInfo.transactor || '--' }}</td>
            <td class="title">企业负责人联系方式</td>
            <td class="content">{{ enterpriseInfo.transactorTel || '--' }}</td>
          </tr>
          <tr>
            <td class="title">奖惩时间</td>
            <td class="content">{{ enterpriseInfo.startDate || '--' }}</td>
            <td class="title">奖惩时间截止至</td>
            <td class="content">{{ enterpriseInfo.endDate || '--' }}</td>
          </tr>
          <tr v-if="isCzUser()">
            <td class="title">是否清退出滁州市场</td>
            <td colspan="3">
              {{ enterpriseInfo.isClear === 1 ? '是' : '否' }}
            </td>
          </tr>
          <tr>
            <td class="title">奖惩原因</td>
            <td colspan="3">{{ enterpriseInfo.reason || '--' }}</td>
          </tr>
          <tr>
            <td class="title">奖惩资料</td>
            <td colspan="3" v-if="enterpriseInfo.fileList.length > 0">
              <!-- <template v-for="(item,index) in enterpriseInfo.fileList">
                                <div class="interval" :key="index">
                                    <a target="_blank" class="aLink mouseOn" :href="item.absolutePath">{{item.originalName || "--"}}</a>
                                </div>
                            </template> -->
              <el-link type="primary" @click="show()">查看</el-link>
            </td>
            <td colspan="3" v-else>--</td>
          </tr>
        </tbody>
      </table>
      <el-dialog
        title="奖惩资料"
        :visible.sync="seeUploadDialog"
        :modal-append-to-body="false"
        width="900px"
        :append-to-body="true"
      >
        <contractEnclosure :isShowType="false" :tableData="uploadDataList" />
      </el-dialog>
    </div>
  </div>
</template>
<script>
export default {
  name: 'enterpriseRewardAndPunishDetail',
  data() {
    return {
      titleText: '企业奖惩详情',
      back: true,
      enterpriseInfo: {
        fileList: [],
      },
      id: '', //列表传过来的主键id
      uploadDataList: [],
      seeUploadDialog: false,
    }
  },
  created() {
    this.id = this.$route.query.id
    this.getDetail()
  },
  methods: {
    getDetail(id) {
      this.axios({
        method: 'get',
        url: 'api-r/reward/expand/detail?id=' + this.id,
      })
        .then((response) => {
          this.enterpriseInfo = response.data.result
        })
        .catch((error) => {
          this.$message.error('数据获取失败')
        })
    },
    goBack() {
      this.$router.push('/home/events/rewardAndPunish')
      this.$store.commit('GOBACK_NAME', {
        oldUrl: '/home/events/rewardAndPunish',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    show() {
      this.seeUploadDialog = true
      this.uploadDataList = this.enterpriseInfo.fileList
    },
  },
}
</script>
<style scoped lang="less">
.container {
  .mainCon {
    top: 198px;
    color: #333;
    font-size: 14px;
    padding: 24px;
    table {
      .general {
        color: #6dd400;
      }
      .serious {
        color: #e02020;
      }
      .aLink {
        color: #00a0e9;
      }
    }
  }
}
.detailTable .title {
  width: 177px !important;
}
</style>
